package com.woniuxy.springbootrabbit.dead;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.Date;

@Component
public class DeadProducter {
    @Resource
    private AmqpTemplate amqpTemplate;

    public void send(String msg,String routingKey){
        // 将消息发送到交换机
        // 参数1：交换机
        // 参数2：路由
        // 参数3：消息
        System.out.println("producter:" + new Date());
        amqpTemplate.convertAndSend("ttl_exchange", routingKey, msg);
    }
}
